Skip to content

Revert "deprecation(groupComparisonPTM): Deprecate data.type parameter#126

Merged
tonywu1999 merged 1 commit intodevelfrom
revert-groupComparisonPTM
Mar 30, 2026
Merged

Revert "deprecation(groupComparisonPTM): Deprecate data.type parameter#126
tonywu1999 merged 1 commit intodevelfrom
revert-groupComparisonPTM

Conversation

@tonywu1999
Copy link
Copy Markdown
Contributor

@tonywu1999 tonywu1999 commented Mar 30, 2026

This reverts commit 0630b43. I'm thinking we should wait for a major release (like upgrading MSstatsPTM to 3.x) before doing a change that is not backwards compatibility. Plus we should do this during a release that's not before May Institute.

Motivation and Context

Please include relevant motivation and context of the problem along with a short summary of the solution.

Changes

Please provide a detailed bullet point list of your changes.

Testing

Please describe any unit tests you added or modified to verify your changes.

Checklist Before Requesting a Review

  • I have read the MSstats contributing guidelines
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Motivation and Context

This PR reverts commit 0630b43 which deprecated the data.type parameter in the groupComparisonPTM() function. The reversion is necessary to maintain backward compatibility with existing code. The author postpones the removal of data.type until a major release (e.g., MSstatsPTM 3.x) rather than removing it in the current development version to avoid breaking changes for existing users who rely on the parameter.

Changes

  • Function signature restoration in R/groupComparisonPTM.R:

    • Restored data.type = NULL parameter as the second argument in the function signature
    • Reverted ptm_label_type default from c("LF", "TMT") (with match.arg validation) back to scalar "LF"
    • Reverted protein_label_type default from c("LF", "TMT") (with match.arg validation) back to scalar "LF"
    • Moved both label type parameters to the end of the function signature (after base parameter)
    • Restored the conditional logic that maps data.type values to ptm_label_type and protein_label_type when data.type is provided
    • Restored the deprecation warning at function end, alerting users that data.type will be deprecated in favor of the two label-type arguments prior to Release 3.22
    • Removed match.arg() validation calls on the label type parameters
  • Documentation restoration in man/groupComparisonPTM.Rd:

    • Restored data.type = NULL parameter documentation
    • Moved ptm_label_type and protein_label_type back to end of parameter list with scalar defaults "LF"
    • Shortened documentation descriptions for label type parameters back to simple indicators
    • Removed the expanded documentation that was added to clarify the label type parameters in the deprecation commit
  • Infrastructure files added:

    • .Rbuildignore: Standard R package build exclusions
    • .gitignore: Repository exclusions for R artifacts
    • .travis.yml: Travis CI configuration
    • .github/pull_request_template.md: Pull request template with sections for motivation, changes, testing, and checklist
    • .github/workflows/dry-run-build.yml: GitHub Actions workflow for PR builds and checks

Testing

The existing tests in inst/tinytest/test_groupComparisonPTM.R remain valid and continue to use the explicit ptm_label_type and protein_label_type parameters with their scalar values ("LF" and "TMT"). The tests do not require modification as they were already adapted to use the explicit label type parameters rather than the data.type parameter.

Coding Guidelines

No coding guideline violations are introduced. The reversion maintains consistent parameter handling and documentation practices with the pre-deprecation code structure.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

📝 Walkthrough

Walkthrough

The groupComparisonPTM() function signature is updated to introduce a new data.type parameter that serves as a convenience override for both ptm_label_type and protein_label_type. The original parameters now use scalar defaults instead of vector choices, with match.arg() validation removed. A deprecation warning is emitted when data.type is used.

Changes

Cohort / File(s) Summary
Function Implementation
R/groupComparisonPTM.R
New data.type parameter added (default NULL); when set to "TMT" or "LF", it overwrites both label-type parameters. Parameter validation changed from match.arg() to direct string comparison. Deprecation warning emitted when data.type is non-NULL. Scalar defaults introduced for ptm_label_type and protein_label_type.
Documentation
man/groupComparisonPTM.Rd
Function signature updated to reflect new data.type parameter and repositioned arguments. Vector defaults for label-type parameters replaced with scalar defaults. Documentation added for data.type parameter explaining deprecation path and updated descriptions for label-type arguments.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A shorthand hopped in, data.type so neat,
Overwriting labels, making code more sweet,
Yet whispers of deprecation softly sing,
Tomorrow's path converges to one thing! 🌱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: reverting a deprecation of the data.type parameter in the groupComparisonPTM function.
Description check ✅ Passed The description provides a clear reason for the revert (backward compatibility and timing concerns), but most template sections lack substantive detail beyond the revert statement.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert-groupComparisonPTM

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
R/groupComparisonPTM.R (1)

127-172: ⚠️ Potential issue | 🟠 Major

Add a hard guard for unsupported label types to avoid undefined models.

If ptm_label_type or protein_label_type is not "LF"/"TMT", neither branch runs and downstream objects (e.g., ptm_model, protein_model) can be undefined. Add an explicit else stop(...) (or upfront validation) for both paths.

Proposed fix
   if (ptm_label_type == "TMT"){
@@
   } else if (ptm_label_type == "LF") {
@@
+  } else {
+    stop("`ptm_label_type` must be one of 'LF' or 'TMT'.")
   }
@@
     if (protein_label_type == "TMT"){
@@
     } else if (protein_label_type == "LF") {
@@
+    } else {
+      stop("`protein_label_type` must be one of 'LF' or 'TMT'.")
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@R/groupComparisonPTM.R` around lines 127 - 172, The code lacks guards for
unsupported label types causing ptm_model or protein_model to remain undefined;
add explicit validation or an else branch that calls stop() when ptm_label_type
or protein_label_type is not "TMT" or "LF". Locate the two decision blocks that
check ptm_label_type (around the calls to groupComparisonTMT and
groupComparison) and protein_label_type (around the calls to groupComparisonTMT
and groupComparison) and add an else stop("Unsupported ptm_label_type: ...") /
stop("Unsupported protein_label_type: ...") (or perform an upfront check
validating ptm_label_type and protein_label_type and aborting), so downstream
variables like ptm_model, ptm_model_details, protein_model and
protein_model_details are always defined.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@R/groupComparisonPTM.R`:
- Around line 94-97: Validate data.type explicitly: if data.type is not NULL,
check if it is one of c("TMT","LF") and if not call stop() with a clear error
message; otherwise (when valid) set ptm_label_type and protein_label_type to
data.type. Replace the current conditional that only assigns on equality with an
explicit validation block using data.type %in% c("TMT","LF") and stop(...) for
invalid values so the code fails fast.
- Around line 246-250: The deprecation warning for the argument data.type in
groupComparisonPTM.R (the if block checking !is.null(data.type) && (data.type ==
"TMT" || data.type == "LF")) must be removed or disabled to match the revert's
compatibility goal; update that block to stop emitting warning (either delete
the warning call or replace it with a no-op comment and/or a
FUTURE_DEPRECATION_FLAG check) so users are not shown the deprecation message
now while preserving the condition logic for future reintroduction.

---

Outside diff comments:
In `@R/groupComparisonPTM.R`:
- Around line 127-172: The code lacks guards for unsupported label types causing
ptm_model or protein_model to remain undefined; add explicit validation or an
else branch that calls stop() when ptm_label_type or protein_label_type is not
"TMT" or "LF". Locate the two decision blocks that check ptm_label_type (around
the calls to groupComparisonTMT and groupComparison) and protein_label_type
(around the calls to groupComparisonTMT and groupComparison) and add an else
stop("Unsupported ptm_label_type: ...") / stop("Unsupported protein_label_type:
...") (or perform an upfront check validating ptm_label_type and
protein_label_type and aborting), so downstream variables like ptm_model,
ptm_model_details, protein_model and protein_model_details are always defined.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2b526817-bdcd-4754-b6cd-6713a75c47c3

📥 Commits

Reviewing files that changed from the base of the PR and between 0f49cc2 and 79118ff.

📒 Files selected for processing (2)
  • R/groupComparisonPTM.R
  • man/groupComparisonPTM.Rd

Comment on lines +94 to +97
if (!is.null(data.type) && (data.type == "TMT" || data.type == "LF")) {
ptm_label_type = data.type
protein_label_type = data.type
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Validate data.type explicitly instead of silently ignoring invalid values.

Line 94 only applies overrides for "LF"/"TMT"; other values are ignored despite docs saying this argument “must be one of” those values. Please fail fast with a clear error.

Proposed fix
+  valid_label_types <- c("LF", "TMT")
+
-  if (!is.null(data.type) && (data.type == "TMT" || data.type == "LF")) {
-      ptm_label_type = data.type
-      protein_label_type = data.type
-  }
+  if (!is.null(data.type)) {
+    if (!(data.type %in% valid_label_types)) {
+      stop("`data.type` must be one of 'LF' or 'TMT'.")
+    }
+    ptm_label_type = data.type
+    protein_label_type = data.type
+  }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@R/groupComparisonPTM.R` around lines 94 - 97, Validate data.type explicitly:
if data.type is not NULL, check if it is one of c("TMT","LF") and if not call
stop() with a clear error message; otherwise (when valid) set ptm_label_type and
protein_label_type to data.type. Replace the current conditional that only
assigns on equality with an explicit validation block using data.type %in%
c("TMT","LF") and stop(...) for invalid values so the code fails fast.

Comment on lines +246 to +250
if (!is.null(data.type) && (data.type == "TMT" || data.type == "LF")) {
warning("DEPRECATION NOTICE: The `data.type` argument is being deprecated.
Please use `ptm_label_type` and `protein_label_type` instead ahead
of Release 3.22")
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Deprecation warning conflicts with this revert’s compatibility goal.

Line 247 still emits a deprecation notice for data.type. That appears inconsistent with the PR objective to postpone deprecation until a future major release, and keeps deprecation behavior user-visible now.

Proposed fix
-  if (!is.null(data.type) && (data.type == "TMT" || data.type == "LF")) {
-      warning("DEPRECATION NOTICE: The `data.type` argument is being deprecated. 
-              Please use `ptm_label_type` and `protein_label_type` instead ahead
-              of Release 3.22")
-  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!is.null(data.type) && (data.type == "TMT" || data.type == "LF")) {
warning("DEPRECATION NOTICE: The `data.type` argument is being deprecated.
Please use `ptm_label_type` and `protein_label_type` instead ahead
of Release 3.22")
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@R/groupComparisonPTM.R` around lines 246 - 250, The deprecation warning for
the argument data.type in groupComparisonPTM.R (the if block checking
!is.null(data.type) && (data.type == "TMT" || data.type == "LF")) must be
removed or disabled to match the revert's compatibility goal; update that block
to stop emitting warning (either delete the warning call or replace it with a
no-op comment and/or a FUTURE_DEPRECATION_FLAG check) so users are not shown the
deprecation message now while preserving the condition logic for future
reintroduction.

@tonywu1999 tonywu1999 merged commit 8867977 into devel Mar 30, 2026
2 checks passed
@tonywu1999 tonywu1999 deleted the revert-groupComparisonPTM branch March 30, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant